package org.jeecg.modules.knowledge.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;

/**
 * @Description: 知识
 * @Author: jeecg-boot
 * @Date:   2020-12-20
 * @Version: V1.0
 */
@Data
@TableName("phil_knowledge")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="phil_knowledge对象", description="知识")
public class PhilKnowledge implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private java.lang.String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private java.lang.String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private java.util.Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private java.lang.String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private java.util.Date updateTime;
	/**所属部门*/
    @ApiModelProperty(value = "所属部门")
    private java.lang.String sysOrgCode;
	/**知识标题*/
	@Excel(name = "知识标题", width = 15)
    @ApiModelProperty(value = "知识标题")
    private java.lang.String knowledgeTitle;
	/**作者*/
	@Excel(name = "作者", width = 15)
    @ApiModelProperty(value = "作者")
    private java.lang.String knowledgeAuthor;
	/**内容*/
	@Excel(name = "内容", width = 15)
    @ApiModelProperty(value = "内容")
    private java.lang.String knowledgeContent;
	/**知识类别*/
	@Excel(name = "知识类别", width = 15, dicCode = "articleClassfiy")
	@Dict(dicCode = "articleClassfiy")
    @ApiModelProperty(value = "知识类别")
    private java.lang.String knowledgeType;
	/**知识简介*/
	@Excel(name = "知识简介", width = 15)
    @ApiModelProperty(value = "知识简介")
    private java.lang.String knowledgeIntroduction;
	/**图片*/
	@Excel(name = "图片", width = 15)
    @TableField(exist = false)
    private java.lang.String knowledgeImageString;

	/**文章置顶  1置顶 0不置顶*/
    @ApiModelProperty(value = "文章置顶")
    private int knowledgeColumnTop;

    private byte[] knowledgeImage;

    public byte[] getKnowledgeImage(){
        if(knowledgeImageString==null){
            return null;
        }
        try {
            return knowledgeImageString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getKnowledgeImageString(){
        if(knowledgeImage==null || knowledgeImage.length==0){
            return "";
        }
        try {
            return new String(knowledgeImage,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
	/**关键字*/
	@Excel(name = "关键字", width = 15)
    @ApiModelProperty(value = "关键字")
    private java.lang.String knowledgeKeywords;
	/**能否评论*/
	@Excel(name = "能否评论", width = 15)
    @ApiModelProperty(value = "能否评论")
    private java.lang.Integer knowledgeEnableComment;
	/**能否评论*/
	@Excel(name = "阅读量", width = 15)
    @ApiModelProperty(value = "阅读量")
    private java.lang.Integer knowledgeReadingNum;
}
